﻿using FreeSql;
using FreeSql.DataAnnotations;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BBCore.Core.Models.Admins
{
    [Table(Name = "HYJ_USER")]
    [Description("用户信息表")]
    [Index("uk_UserName", "UserName", true)] //唯一键
    public class UserEntity : BaseEntity<UserEntity, int>
    {
      
        [Display(Name ="用户名")]
        [Required(ErrorMessage = "用户名不能为空")]
       
        public string? UserName { get; set; }

        [Display(Name = "用户密码")]
        [Required(ErrorMessage = "密码不可为空")]
        public string? Password { get; set; }

        [Display(Name = "显示名")]
        public string? NickName { get; set; }

        [Display(Name = "头像地址")]
        public string? AvatarPath { get; set; }

        [Display(Name = "角色Id")]
        [Required(ErrorMessage = "角色不可为空")]
        public int RoleId { get; set; }

        [Navigate(nameof(RoleId))]
        public RoleEntity? Role { get; set; }
    }
}
